<template>
  <div class="page-header-index-wide">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <!-- 搜索区域 -->
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="10" :sm="12">
            <a-form-item label="闪兑时间" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <j-date v-model="queryParam.timestamp_begin"
                      date-format="YYYY-MM-DD"
                      style="width:45%" placeholder="请选择开始时间" >
              </j-date>
              <span style="width: 10px;">~</span>
              <j-date v-model="queryParam.timestamp_end"
                      date-format="YYYY-MM-DD"
                      style="width:45%" placeholder="请选择结束时间" >
              </j-date>
            </a-form-item>
          </a-col>
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
              <a-button type="primary" @click="searchQuery">查询</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>

    <a-table
      ref="table"
      bordered
      size="middle"
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange">
      <template slot="exchangeType" slot-scope="type">
        <span v-if="type == 'day'">日闪兑</span>
        <span v-else>月闪兑</span>
      </template>
    </a-table>
  </div>
</template>

<script>
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import JDate from '@/components/jeecg/JDate'
export default {
  name: "ExchangeReport",
  mixins: [JeecgListMixin],
  components: {
    JDate,
  },
  data() {
    return {
      columns: [
        {
          title: '账户',
          align: "center",
          dataIndex: 'caller',
        },
        {
          title: '闪兑金额',
          align: "center",
          dataIndex: 'amountToken',
        },
        {
          title: 'TRX',
          align: "center",
          dataIndex: 'amountTrx',
        },
        {
          title: '汇率',
          align: "center",
          dataIndex: 'currency',
        },
        {
          title: '类型',
          align: "center",
          dataIndex: 'exchangeType',
          scopedSlots: { customRender: 'exchangeType' },
        },
        {
          title: '闪兑时间',
          align: "center",
          width: 150,
          dataIndex: 'timestamp',
        }
      ],
      isorter:{
        column: 'timestamp',
        order: 'desc',
      },
      url:{
        list: "/exchange/list"
      }
    }
  },
  methods: {

  }
}
</script>

<style lang="scss" scoped>
  .page-header-index-wide{
    padding: 24px 32px;
    background-color: #fff;
  }
</style>